package com.chixing.day06_static.static_demo;

public class Student {
    static {
        System.out.println("static 代码块1");
    }

    public static int a = 10;//类变量 Student.a[共享数据区]
    public static Student stu = new Student();

    public int b = 20;//初始化对象时 b=20
                      //实例变量:Student stu1 = new Student()  stu1.b
                      //实例变量:Student stu2 = new Student()  stu2.b
    public int c;
    static {
        System.out.println("static 代码块2");
    }

    public Student(){
        System.out.println("构造函数 b =" + b);
        System.out.println("构造函数 c =" + c);
        System.out.println("Student的无参构造函数");
    }
    //构造块、普通代码块（几乎不用）
    {
        System.out.println("构造块");
        System.out.println("构造块 b =" + b);
        System.out.println("构造块 c =" + c);
    }
}
